package com.ship.dispatch.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ship.dispatch.bean.HomePage.ConHomePage;
import com.ship.dispatch.bean.ConShipping;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ConShippingMapper extends BaseMapper<ConShipping> {
    /**
     * 根据imo查询船运合同信息
     */
    @Select("SELECT * FROM con_shipping WHERE imo = #{imo} and status !=4")
    List<ConShipping> getByIMO(@Param("imo") String imo);

    @Select("select sis.imo from sp_information sis where sis.name_of_vessel not like '%虚拟船%' group by sis.imo")
    List<String> queryImoList();

    List<ConShipping> queryRentShipNumber(@Param("endDate") String endDate);

    Integer queryTransportShipNumber();


//    @Select("SELECT id, imo, delivery_date_begin, delivery_date_end, ship_name , prime_mover_descriptive_narrative , cabin_capacity , evaporation_rate , empty_evaporation_rate FROM con_shipping  WHERE CURRENT_TIMESTAMP > delivery_date_begin  AND CURRENT_TIMESTAMP < delivery_date_end")
    @Select("SELECT id, imo, delivery_date_begin, redelivery_date_end FROM con_shipping  WHERE CURRENT_TIMESTAMP > delivery_date_begin  AND CURRENT_TIMESTAMP < redelivery_date_end AND file_type IN (1, 2) AND del_apply = 0;")
    List<ConShipping> getShipImo();

    void updateByImo(@Param("conHomePageList") List<ConHomePage> conHomePageList);

    @Delete("DELETE FROM sp_homepage")
    void clearTable();
}
